#include "rb_tree.h"
#include <iostream>

using std::cout;
using std::endl;

void test1()
{
    using Node = RB_Tree<int>::Node;
    RB_Tree<int> tree;
    Node *n1 = new Node(5);
    Node *n2 = new Node(2);
    Node *n3 = new Node(8);
    Node *n4 = new Node(-1);
    Node *n5 = new Node(4);
    Node *n6 = new Node(-2);
    Node *n7 = new Node(0);

    tree.root_ = n1;
    n1->left_ = n2;
    n2->parent_ = n1;
    n1->right_ = n3;
    n3->parent_ = n1;
    n2->left_ = n4;
    n4->parent_ = n2;
    n2->right_ = n5;
    n5->parent_ = n2;
    n4->left_ = n6;
    n6->parent_ = n4;
    n4->right_ = n7;
    n7->parent_ = n4;

    tree.leftRotate(n2);
    int i = 0;
}

void test2()
{
    RB_Tree<int> tree;
    tree.insert(50);
    tree.insert(40);
    tree.insert(60);
    tree.setColor(tree.root_->right_, RB_Tree<int>::Color::BLACK);
    tree.insert(30);

    int i = 0;
}

void test3()
{

    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    RB_Tree<int> tree;
    for (int i{}; i < 10; i++)
    {
        tree.insert(arr[i]);
    }

    tree.remove(9);
    tree.remove(10);
    tree.remove(5);
    tree.remove(4);
    int i = 10;
}

int main(int args, char *argv[])
{
    // test1();
    // test2();
    test3();
    return 0;
}